<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>文章管理</title>
    <!-- Le styles -->
    <link href="/common/js/bootstrap-3.0.0/css/bootstrap-united.min.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding: 10px 0;
        }
    </style>
</head>
<body>
<div class="container">

    <div class="col-md-12 text-right" style="margin:10px 0;">
        <a style="width: 80px;" href="/content/addArticleView" class="btn btn-success">新建</a>
    </div>

        <table id="resultTable" class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>编号</th>
                <th>显示位置</th>
                <th>文章类型</th>
                <#--<th>图片</th>-->
                <th>标题</th>
                <th>状态</th>
                <th>访问量</th>
                <th>发布人编号</th>
                <th>详情</th>
            </tr>
            </thead>
            <tbody>
            <script type="text/html">
                <tr>
                    <td>{{id}}</td>
                    <td>{{positionId?renderPositionType}}</td>
                    <td>{{articleType?renderArticleType}}</td>
                    <#--<td>{{imgUrl?renderImg}}</td>-->
                    <td>{{name}}</td>
                    <td>{{status?renderStatus}}</td>
                    <td>{{viewCount}}</td>
                    <td>{{userId!''}}</td>
                    <td><a style="width: 80px;" href="/content/editArticleView?id={{id}}" class="btn btn-success">编辑</a></td>
                </tr>
            </script>
            </tbody>
        </table>
</div>
<#--<div align="center">-->
<#--<#include "../footer.ftl"/>-->
<#--</div>-->
<script type="text/javascript" src="/common/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap-table.20130913.js"></script>
<script type="text/javascript" src="/common/js/dateformat.js"></script>
<script type="text/javascript" src="/common/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function () {
        var param = $("#form").serialize();
        var s = $("#resultTable").bsTable({
            url: '/content/getArticleList.json',
            ajaxType: "POST",  //ajax 提交方式 post 或者 get
            pageNo: 1,
            pageNoAlias: 'page',
            pageSize: 10,
            pageSizeAlias: 'pageSize',
            pagingAlign: "right",
            param: param,
            countRoot: "total",
            dataRoot: "list"
        });

        $("#searchBtn").on('click', function () {
            var param = $("#form").serialize();
            s.reload(param);
        });

//        window.onresize = function () {
//            window.top.autoIFrame();
//        }
    });

    function renderImg(imgUrl) {
        return "<img src=\"http://img.boyitongcheng.com/"+imgUrl+"\" width=\"60px\" height=\"40px\"/>";
    }

    function renderArticleType(articleType) {
        if (articleType == 1) {
            return "婚礼知识";
        } else if(articleType == 2) {
            return "新手指导";
        }else{
            return "婚礼学院";
        }
    }

    function renderPositionType(positionId) {
        if (positionId == 1) {
            return "在线预订";
        } else if(positionId == 2) {
            return "消费保障";
        }else{
            return "售后服务";
        }
    }

    function renderStatus(status) {
        if (status == -1) {
            return "删除不显示";
        } else {
            return "启用";
        }
    }
</script>
</body>
</html>